/**
 * 
 */
package org.vectrics.recruiter.struts.admin.person;

import javax.servlet.jsp.JspException;

import org.vectrics.cv.Career;
import org.vectrics.recruiter.RecruitServiceLocator;
import org.vectrics.struts.VectricsActionData;
import org.vectrics.struts.VectricsStrutsAction;

/**
 * @author pgoette
 * 
 * Clase encargada de mostrar los datos de career para editarlo.
 */
public class EditCareerAction extends VectricsStrutsAction {


	@Override
	protected String doExecute(VectricsActionData actionData)
			throws JspException {

		String forward = "success";
		// Busco el id
		String idCareer = actionData.getRequest().getParameter("careerId");
        CareerForm form = (CareerForm) actionData.getForm();
		
        if ((idCareer!=null) && (!idCareer.trim().equals("")))
		{
        	// Busco la carrera segun el id.
        	Career career = RecruitServiceLocator.getPersonService().findCareer(new Long(idCareer));
        	form.setId(career.getId().toString());
        	form.setCareer(career.getCareer());
		}
        
		return forward;
	}

}
